<template>
  <a-select
    v-model="selectValue"
    v-bind="$attrs"
    :disabled="disabled"
    v-on="$listeners"
  >
    <slot />
  </a-select>
</template>
<script>
export default {
  name: 'PSelect',
  inheritAttrs: true,
  props: {
    authKey: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      selectValue: this.$attrs.value
    }
  },
  computed: {
    disabled() {
      if (this.authKey) {
        const flag = this.useBtnRoot[this.authKey]
        return !flag || this.$attrs.disabled
      }
      return this.$attrs.disabled
    }
  },
  watch: {
    '$attrs.value'(val) {
      this.selectValue = val
    },
    selectValue(val) {
      this.$emit('input', val)
      console.log(3333, val)
    }
  }
}
</script>
